/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VeiculoOrcamento.java
 *
 * Created on 12/05/2011, 05:05:20
 */
package localizarInserir;

import Classe.BD;
import Classe.Marca;
import Classe.Modelo;
import Classe.Validacao;
import Classe.Veiculo;
import Tela.CadastroOrcamento;
import editar.EditarOrcamentoFisica;
import editar.EditarOrcamentoJuridica;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author gladson
 */
public class VeiculoOrcamento extends Validacao {

    /** Creates new form VeiculoOrcamento */
    public VeiculoOrcamento() {
        initComponents();
        this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    }
    CadastroOrcamento cadastroPF;
    CadastroOrcamento cadastroPJ;
    EditarOrcamentoFisica editarOrcaPF;
    EditarOrcamentoJuridica editarOrcaPJ;
    int idCli;
    int idVeic;
    int opcPjouPf;
    Veiculo veiculo;
    Marca marca;
    Modelo modelo;

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tabelaVeiculo = new javax.swing.JTable();
        jButton2 = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        txtIdVeiculo = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        tabelaVeiculo.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Código", "Modelo", "Cor", "Placa", "Ano", "Marca"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                true, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane1.setViewportView(tabelaVeiculo);

        jButton2.setText("Sair");
        jButton2.setToolTipText("Sair");
        jButton2.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jPanel3.setBackground(new java.awt.Color(255, 255, 255));
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        jLabel1.setFont(new java.awt.Font("Arial", 1, 11));
        jLabel1.setText("Código do Veículo");

        txtIdVeiculo.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEtchedBorder(), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));

        jButton1.setText("Incluir");
        jButton1.setToolTipText("Incluir Veículo");
        jButton1.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(txtIdVeiculo, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jButton1)
                .addContainerGap(503, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtIdVeiculo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 748, Short.MAX_VALUE)
                    .addComponent(jButton2, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jButton2)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-808)/2, (screenSize.height-627)/2, 808, 627);
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        if (validarNumero(txtIdVeiculo.getText())) {


            if (opcPjouPf == 1) {
                idVeic = Integer.parseInt(txtIdVeiculo.getText());
                BD banco = new BD();

                String sql = "SELECT V.ID_VEICULO,M.MODELO,V.COR_VEICULO,V.PLACA_VEICULO,V.ANO_VEICULO,MA.MARCA "
                        + "FROM VEICULO V INNER JOIN MODELO M ON V.ID_MODELO=M.ID_MODELO INNER JOIN "
                        + "MARCA MA ON M.ID_MARCA=MA.ID_MARCA "
                        + "WHERE ID_CLIENTE= " + idCli + " AND V.ID_VEICULO=" + idVeic;
                try {
                    ResultSet res = banco.consultar(sql);
                    veiculo = new Veiculo();
                    modelo = new Modelo();
                    marca = new Marca();
                    if (res.next()) {
                        veiculo.setIdVeiculo(res.getInt("ID_VEICULO"));
                        veiculo.setCorVeiiculo(res.getString("COR_VEICULO"));
                        veiculo.setPlacaVeiculo(res.getString("PLACA_VEICULO"));
                        veiculo.setAnoVeiculo(res.getString("ANO_VEICULO"));
                        marca.setNomeMarca(res.getString("MARCA"));
                        modelo.setModelo(res.getString("MODELO"));

                        cadastroPF.preencherVeiculo(veiculo, modelo, marca);
                        this.dispose();
                    } else {
                        JOptionPane.showMessageDialog(rootPane, "Veiculo não localizado na base dados!!");
                        txtIdVeiculo.setText("");
                    }
                } catch (ClassNotFoundException ex) {
                    Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
                } catch (SQLException ex) {
                    Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else if (opcPjouPf == 2) {
                idVeic = Integer.parseInt(txtIdVeiculo.getText());
                BD banco = new BD();

                String sql = "SELECT V.ID_VEICULO,M.MODELO,V.COR_VEICULO,V.PLACA_VEICULO,V.ANO_VEICULO,MA.MARCA "
                        + "FROM VEICULO V INNER JOIN MODELO M ON V.ID_MODELO=M.ID_MODELO INNER JOIN "
                        + "MARCA MA ON M.ID_MARCA=MA.ID_MARCA "
                        + "WHERE ID_CLIENTE_PJ = " + idCli + " AND V.ID_VEICULO=" + idVeic;
                try {
                    ResultSet res = banco.consultar(sql);
                    veiculo = new Veiculo();
                    modelo = new Modelo();
                    marca = new Marca();
                    if (res.next()) {
                        veiculo.setIdVeiculo(res.getInt("ID_VEICULO"));
                        veiculo.setCorVeiiculo(res.getString("COR_VEICULO"));
                        veiculo.setPlacaVeiculo(res.getString("PLACA_VEICULO"));
                        veiculo.setAnoVeiculo(res.getString("ANO_VEICULO"));
                        marca.setNomeMarca(res.getString("MARCA"));
                        modelo.setModelo(res.getString("MODELO"));

                        cadastroPJ.preencherVeiculo(veiculo, modelo, marca);
                        this.dispose();
                    } else {
                        JOptionPane.showMessageDialog(rootPane, "Veiculo não localizado na base dados!!");
                        txtIdVeiculo.setText("");
                    }

                } catch (ClassNotFoundException ex) {
                    Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
                } catch (SQLException ex) {
                    Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else if (opcPjouPf == 3) {
                idVeic = Integer.parseInt(txtIdVeiculo.getText());
                BD banco = new BD();

                String sql = "SELECT V.ID_VEICULO,M.MODELO,V.COR_VEICULO,V.PLACA_VEICULO,V.ANO_VEICULO,MA.MARCA "
                        + "FROM VEICULO V INNER JOIN MODELO M ON V.ID_MODELO=M.ID_MODELO INNER JOIN "
                        + "MARCA MA ON M.ID_MARCA=MA.ID_MARCA "
                        + "WHERE ID_CLIENTE= " + idCli + " AND V.ID_VEICULO=" + idVeic;
                try {
                    ResultSet res = banco.consultar(sql);
                    veiculo = new Veiculo();
                    modelo = new Modelo();
                    marca = new Marca();
                    if (res.next()) {
                        veiculo.setIdVeiculo(res.getInt("ID_VEICULO"));
                        veiculo.setCorVeiiculo(res.getString("COR_VEICULO"));
                        veiculo.setPlacaVeiculo(res.getString("PLACA_VEICULO"));
                        veiculo.setAnoVeiculo(res.getString("ANO_VEICULO"));
                        marca.setNomeMarca(res.getString("MARCA"));
                        modelo.setModelo(res.getString("MODELO"));

                        editarOrcaPF.preencherVeiculo(veiculo, modelo, marca);
                        this.dispose();
                    } else {
                        JOptionPane.showMessageDialog(rootPane, "Veiculo não localizado na base dados!!");
                        txtIdVeiculo.setText("");
                    }
                } catch (ClassNotFoundException ex) {
                    Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
                } catch (SQLException ex) {
                    Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
                }
            } else if (opcPjouPf == 4) {
                idVeic = Integer.parseInt(txtIdVeiculo.getText());
                BD banco = new BD();

                String sql = "SELECT V.ID_VEICULO,M.MODELO,V.COR_VEICULO,V.PLACA_VEICULO,V.ANO_VEICULO,MA.MARCA "
                        + "FROM VEICULO V INNER JOIN MODELO M ON V.ID_MODELO=M.ID_MODELO INNER JOIN "
                        + "MARCA MA ON M.ID_MARCA=MA.ID_MARCA "
                        + "WHERE ID_CLIENTE_PJ= " + idCli + " AND V.ID_VEICULO=" + idVeic;
                try {
                    ResultSet res = banco.consultar(sql);
                    veiculo = new Veiculo();
                    modelo = new Modelo();
                    marca = new Marca();
                    if (res.next()) {
                        veiculo.setIdVeiculo(res.getInt("ID_VEICULO"));
                        veiculo.setCorVeiiculo(res.getString("COR_VEICULO"));
                        veiculo.setPlacaVeiculo(res.getString("PLACA_VEICULO"));
                        veiculo.setAnoVeiculo(res.getString("ANO_VEICULO"));
                        marca.setNomeMarca(res.getString("MARCA"));
                        modelo.setModelo(res.getString("MODELO"));

                        editarOrcaPJ.preencherVeiculo(veiculo, modelo, marca);
                        this.dispose();
                    } else {
                        JOptionPane.showMessageDialog(rootPane, "Veiculo não localizado na base dados!!");
                        txtIdVeiculo.setText("");
                    }
                } catch (ClassNotFoundException ex) {
                    Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
                } catch (SQLException ex) {
                    Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }

    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        this.dispose();        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new VeiculoOrcamento().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable tabelaVeiculo;
    private javax.swing.JTextField txtIdVeiculo;
    // End of variables declaration//GEN-END:variables

    public void iniciar(CadastroOrcamento aThis, int idcli) {
        this.setVisible(true);
        cadastroPF = aThis;
        this.idCli = idcli;
        opcPjouPf = 1;


        BD banco = new BD();

        String sql = "SELECT V.ID_VEICULO,M.MODELO,V.COR_VEICULO,V.PLACA_VEICULO,V.ANO_VEICULO,MA.MARCA "
                + "FROM VEICULO V INNER JOIN MODELO M ON V.ID_MODELO=M.ID_MODELO INNER JOIN "
                + "MARCA MA ON M.ID_MARCA=MA.ID_MARCA "
                + "WHERE ID_CLIENTE = " + idCli;
        try {
            ResultSet res = banco.consultar(sql);
            DefaultTableModel model = (DefaultTableModel) tabelaVeiculo.getModel();
            model.setNumRows(0);

            while (res.next()) {
                veiculo = new Veiculo();
                modelo = new Modelo();
                marca = new Marca();

                Object[] linha = {
                    res.getInt("ID_VEICULO"),
                    res.getString("MODELO"),
                    res.getString("COR_VEICULO"),
                    res.getString("PLACA_VEICULO"),
                    res.getString("ANO_VEICULO"),
                    res.getString("MARCA")
                };

                model.addRow(linha);

            }


        } catch (ClassNotFoundException ex) {
            Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
        }


    }

    public void iniciarS(CadastroOrcamento aThis, int idClie) {
        this.setVisible(true);
        this.cadastroPJ = aThis;
        this.idCli = idClie;
        opcPjouPf = 2;


        BD banco = new BD();

        String sql = "SELECT V.ID_VEICULO,M.MODELO,V.COR_VEICULO,V.PLACA_VEICULO,V.ANO_VEICULO,MA.MARCA "
                + "FROM VEICULO V INNER JOIN MODELO M ON V.ID_MODELO=M.ID_MODELO INNER JOIN "
                + "MARCA MA ON M.ID_MARCA=MA.ID_MARCA "
                + "WHERE ID_CLIENTE_PJ = " + idCli;
        try {
            ResultSet res = banco.consultar(sql);
            DefaultTableModel model = (DefaultTableModel) tabelaVeiculo.getModel();
            model.setNumRows(0);

            while (res.next()) {
                veiculo = new Veiculo();
                modelo = new Modelo();
                marca = new Marca();

                Object[] linha = {
                    res.getInt("ID_VEICULO"),
                    res.getString("MODELO"),
                    res.getString("COR_VEICULO"),
                    res.getString("PLACA_VEICULO"),
                    res.getString("ANO_VEICULO"),
                    res.getString("MARCA")
                };

                model.addRow(linha);

            }


        } catch (ClassNotFoundException ex) {
            Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void iniciar(EditarOrcamentoFisica aThis, int idClie) {

        this.editarOrcaPF = aThis;
        this.idCli = idClie;
        opcPjouPf = 3;


        BD banco = new BD();

        String sql = "SELECT V.ID_VEICULO,M.MODELO,V.COR_VEICULO,V.PLACA_VEICULO,V.ANO_VEICULO,MA.MARCA "
                + "FROM VEICULO V INNER JOIN MODELO M ON V.ID_MODELO=M.ID_MODELO INNER JOIN "
                + "MARCA MA ON M.ID_MARCA=MA.ID_MARCA "
                + "WHERE ID_CLIENTE = " + idCli;
        try {
            ResultSet res = banco.consultar(sql);
            DefaultTableModel model = (DefaultTableModel) tabelaVeiculo.getModel();
            model.setNumRows(0);

            while (res.next()) {
                veiculo = new Veiculo();
                modelo = new Modelo();
                marca = new Marca();

                Object[] linha = {
                    res.getInt("ID_VEICULO"),
                    res.getString("MODELO"),
                    res.getString("COR_VEICULO"),
                    res.getString("PLACA_VEICULO"),
                    res.getString("ANO_VEICULO"),
                    res.getString("MARCA")
                };

                model.addRow(linha);

            }


        } catch (ClassNotFoundException ex) {
            Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.setVisible(true);
    }

    public void iniciar(EditarOrcamentoJuridica aThis, int idClie) {

        this.editarOrcaPJ = aThis;
        this.idCli = idClie;
        opcPjouPf = 4;


        BD banco = new BD();

        String sql = "SELECT V.ID_VEICULO,M.MODELO,V.COR_VEICULO,V.PLACA_VEICULO,V.ANO_VEICULO,MA.MARCA "
                + "FROM VEICULO V INNER JOIN MODELO M ON V.ID_MODELO=M.ID_MODELO INNER JOIN "
                + "MARCA MA ON M.ID_MARCA=MA.ID_MARCA "
                + "WHERE ID_CLIENTE_PJ = " + idCli;
        try {
            ResultSet res = banco.consultar(sql);
            DefaultTableModel model = (DefaultTableModel) tabelaVeiculo.getModel();
            model.setNumRows(0);

            while (res.next()) {
                veiculo = new Veiculo();
                modelo = new Modelo();
                marca = new Marca();

                Object[] linha = {
                    res.getInt("ID_VEICULO"),
                    res.getString("MODELO"),
                    res.getString("COR_VEICULO"),
                    res.getString("PLACA_VEICULO"),
                    res.getString("ANO_VEICULO"),
                    res.getString("MARCA")
                };

                model.addRow(linha);

            }


        } catch (ClassNotFoundException ex) {
            Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(VeiculoOrcamento.class.getName()).log(Level.SEVERE, null, ex);
        }
        this.setVisible(true);
    }
}
